/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package e2h8;
import java.io.*;
/**
 *
 * @author rcerrato
 */
public class E2h8 {

    /**
     * @param args the command line arguments
     */
    static int pos=0;
    public static void main(String[] args) throws IOException
    {
        BufferedReader br=new BufferedReader( new InputStreamReader(System.in) );
        Automoviles auto[]=new Automoviles[5];
        int opcion;
        String res;
        do{
     System.out.println("GESTIÓN ALUMNOS DAW 1º");
     System.out.println("**********************");
     System.out.println("\n1. Introducir automoviles");
     System.out.println("2. Consultar automovil");
     System.out.println("3. Calificar alumno");
     System.out.println("4. Ver todos");
     System.out.println("5. Salir");
     System.out.print("Teclea opcion: ");
     opcion=Integer.parseInt(br.readLine());
     switch (opcion)
     {
         case 1: 
                do{
                    System.out.print("\n\nIntroduce matricula");
                    String mat=br.readLine();
                    System.out.print("Introduce modelo");
                    String mod=br.readLine();
                    System.out.print("Introduce marca");
                    String marc=br.readLine();
                    System.out.print("Año de matriculacion");
                    int añoM=Integer.parseInt(br.readLine());
                    System.out.print("Introduce categoria");
                    int cat=Integer.parseInt(br.readLine());
                    auto[pos]=new Automoviles(mat,mod,marc,añoM,cat);
                    pos++;
                    System.out.println("Otro(S/N)?");
                    res=br.readLine();
                    res=res.toUpperCase();
                }while(res.equals("S"));
             
             break;
         case 2:
             int cont=0;
             do{
             System.out.println(auto[cont].toString());
             cont++;
             }while(cont<=pos);
             break;   
        
             
     }
     }while (opcion!=5);
    }
}
